/**   
 * Copyright © 2017 Fan_繁. All rights reserved.
 * 
 * @Title: CityController.java 
 * @Prject: anger
 * @Package: com.hzt.anger.controller 
 * @Description: TODO
 * @author: ChuanHui   
 * @date: 2017年8月5日 上午10:22:21 
 * @version: V1.0   
 */
package com.hzt.anger.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzt.anger.entity.City;
import com.hzt.anger.service.CityService;

/**
 * @ClassName: CityController
 * @Description: TODO
 * @author: ChuanHui
 * @date: 2017年8月5日 上午10:22:21
 */
@Controller
@RequestMapping("/City")
public class CityController {

	@Autowired
	private CityService cityService;

	@RequestMapping(value = "/allCity", method = RequestMethod.GET)
	public String allCity(HttpServletRequest request, Model model) {
		
		Map<String, Object> map = new HashMap<>();
		/*map.put("countrycode", "AFG");*/
		PageHelper.startPage(1, 10);
		List<City> list = cityService.allCityMq(map);
		PageInfo<City> pageInfo = new PageInfo<>(list);
		model.addAttribute("pageInfo", pageInfo);
		System.err.println(pageInfo.getList().size());
		return "city/citylist";
	}
}
